const {ccclass, property} = cc._decorator;

import {ListItem} from "./ListItem"
@ccclass
export default class ScrollComponent extends cc.Component {
    
@property(cc.Prefab)
slotPrefab:cc.Prefab;
@property(cc.ScrollView)
scrollView:cc.ScrollView;

    onLoad() {
        
        for(let i=0;i<13;i++){
            let news = cc.instantiate(this.slotPrefab)
            let listItem:ListItem = news.getComponent(ListItem)
            
            listItem.textx.string = "zzzzz"
            
            var self = this;
            var url = "head/3";
            cc.loader.loadRes(url, cc.SpriteFrame, function (err, spriteFrame) {
                
                listItem.spritex.spriteFrame = spriteFrame
            });
    
            this.scrollView.content.addChild(news)
            
        }
       
    }

    closeCurrent(){
        this.node.active = false;
    }
}
